package com.qidian.mes.qc.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qidian.mes.pojo.Oqc;
import com.qidian.mes.qc.mapper.OqcMapper;
import com.qidian.mes.qc.service.OqcService;
import com.qidian.mes.util.pojo.MESResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class OqcServiceImpl implements OqcService {
    @Autowired
    private OqcMapper oqcMapper;

    @Override
    public MESResult queryById(Long oqcId) {
        Oqc oqc=null;
        if((oqc=oqcMapper.selectId(oqcId))!=null){
            return  MESResult.ok(oqc);
        }
        return MESResult.empty();
    }

    @Override
    public MESResult list(int page, int limit, Oqc oqc) {
        //开启分页
        PageHelper.startPage(page,limit);
        List<Oqc> list=oqcMapper.list(oqc);
        //组织分页对象
        PageInfo<Oqc> pageInfo=new PageInfo<>(list);
        return MESResult.ok(pageInfo);
    }

}
